package com.zz.parkingsystem.util;

import java.util.Calendar;
import java.util.Date;

public class DateUtil {

    /**
     * 判断指定日期是否是周末
     * @param date 必须是格式化后的日期
     * @return true：是周末
     */
    public static boolean isWeekend(Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        return calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SATURDAY || calendar.get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY;
    }
}
